package com.adopapa.nezhacloud.innerapi.api;

import java.util.Map;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import com.adopapa.nezhacloud.common.RestResponse;
import com.adopapa.nezhacloud.innerapi.config.ServiceConstants;
import com.adopapa.nezhacloud.innerapi.factory.InnerLoginFallbackFactory;

@FeignClient(contextId = "InnerLoginService", value = ServiceConstants.AUTHC_SERVICE, //
		fallbackFactory = InnerLoginFallbackFactory.class)
public interface InnerLoginService {

	@GetMapping(path = "/authc/login/kaptcha.jpg", produces = MediaType.APPLICATION_JSON_VALUE)
	public RestResponse getKaptcha();

	@GetMapping(path = "/authc/login/auth/{token}", produces = MediaType.APPLICATION_JSON_VALUE)
	public RestResponse auth(@PathVariable String token, @RequestParam String accessUrl);

	@PostMapping(path = "/authc/login/login", produces = MediaType.APPLICATION_JSON_VALUE, //
			consumes = MediaType.APPLICATION_JSON_VALUE)
	public RestResponse login(@RequestBody Map<String, String> params);

	@DeleteMapping(path = "/authc/login/logout", consumes = MediaType.APPLICATION_JSON_VALUE)
	public RestResponse logout();

	@PostMapping(path = "/authc/login/refresh", produces = MediaType.APPLICATION_JSON_VALUE)
	public RestResponse refresh(@RequestHeader String authorization);

}
